require 'spec_helper'
require 'macos/conversion_helpers'
require 'osx/cocoa'
include OSX

describe ConversionHelpers do
  include ConversionHelpers
  
  it "should convert Point to NSPoint" do
    p = Point.new(1, 2)
    
    p2 = PointToNSPoint(p)
    p2.x.should == 1
    p2.y.should == 2
  end
  
  it "should convert NSPoint to Point" do
    p = NSMakePoint(1, 2)
    
    p2 = NSPointToPoint(p)
    p2.x.should == 1
    p2.y.should == 2
  end
  
  it "should convert Rect to NSRect" do
    r = [0, 10, 20, 30]
    
    r2 = RectToNSRect(r)
    r2.x.should == 0
    r2.y.should == 10
    r2.width.should == 20
    r2.height.should == 30
  end
  
  it "should convert NSRect to Rect" do
    r = NSMakeRect(0, 10, 20, 30)
    
    r2 = NSRectToRect(r)
    r2.should == [0, 10, 20, 30]
  end
end